$utils.hook.ready(() => {
  const $productsWrapper = $('#productsWrapper')
  const $tabs = $productsWrapper.find('.tab')
  const $lists = $productsWrapper.find('.products')

  $productsWrapper.on('click', '.tab', function (e) {
    const $this = $(this)
    const target = $this.data('target')
    toggleTab(target)
  })

  toggleTab('arrCabinet')

  function toggleTab (tabName) {
    $tabs
      .removeClass('active')
      .filter('#' + tabName + 'Tab')
      .addClass('active')
    $lists.hide().filter('#' + tabName).show()
  }
})
